import {
  BaseEntity,
  Column,
  Entity,
  PrimaryColumn,
  PrimaryGeneratedColumn,
} from 'typeorm'

// 预算申请表
@Entity({ name: 'budget' })
export class Budget extends BaseEntity {
  // 自增主键
  @PrimaryGeneratedColumn({ type: 'int', name: 'id' })
  id: number

  // 预算申请编号
  @PrimaryColumn({
    type: 'varchar',
    name: 'budgetCode',
  })
  budgetCode: string

  // 申请人
  @Column({
    type: 'varchar',
    name: 'receivePerson',
  })
  receivePerson: string

  // 申请人id
  @Column({
    type: 'int',
    name: 'receivePersonId',
  })
  receivePersonId: number

  // 申请部门
  @Column({
    type: 'varchar',
    name: 'receiveBranch',
    nullable: true,
  })
  receiveBranch: string

  // 申请部门id
  @Column({
    type: 'int',
    name: 'receiveBranchId',
    nullable: true,
  })
  receiveBranchId: number

  // 预算名称
  @Column({
    type: 'varchar',
    name: 'budgetName',
  })
  budgetName: string

  // 预算金额
  @Column({
    type: 'double',
    name: 'budgetAmount',
  })
  budgetAmount: number

  // 申请日期
  @Column({
    type: 'varchar',
    name: 'receiveDate',
  })
  receiveDate: string

  // 申请状态 0 进行中 1 驳回 2 成功
  @Column({
    type: 'varchar',
    name: 'receiveType',
  })
  receiveType: string

  // 申请原因
  @Column({
    type: 'varchar',
    name: 'receiveReason',
  })
  receiveReason: string

  // 备注
  @Column({
    type: 'varchar',
    name: 'remark',
    nullable: true,
  })
  remark: string

  // 批复
  @Column({
    type: 'varchar',
    name: 'reason',
    nullable: true,
  })
  reason: string

  // 是否删除
  @Column({
    type: 'tinyint',
    name: 'isDelete',
    nullable: true,
  })
  isDelete: boolean

  // 预算是否已经被使用了
  @Column({
    type: 'tinyint',
    name: 'isUse',
    nullable: true,
  })
  isUse: boolean
}
